package com.linux.huhx.thread;

/**
 * Created by huhx on 2017-05-24.
 */
public class ThreadYieldTest2 {
    public static void main(String[] args) {
        Thread thread = new Thread() {
            @Override
            public void run() {
                Thread.yield();
                System.out.println("in thread 1 " + Thread.currentThread().getPriority());
            }
        };
        thread.start();
        System.out.println("in main thread " + Thread.currentThread().getPriority());
        try {
            thread.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(1000);
                    System.out.println("in thread 2 " + Thread.currentThread().getPriority());
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();

        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("in thread 3 " + Thread.currentThread().getPriority());
            }
        }).start();
    }
}

